<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>

<div class="subnav">
	<div class="content-menu ib-a blue line-x">
		<a href="./index.php?m=contest&c=manage&a=init&is_activity=<?=$is_activity?>" class="on"><em><?php echo L($column)?>列表</em></a>
		<span>|</span>

		<?php if(isset($_GET['id'])){?>
			<a href="./index.php?m=contest&c=manage&a=add&is_activity=<?=$is_activity?>&id=<?=$_GET['id']?>"><em><?php echo L($column)?>添加</em></a>
			<span>|</span>
			<a href="./index.php?m=contest&c=manage&a=init&is_activity=<?=$is_activity?>" ><em>返回上一级</em></a>
		<?php }else{?>
			<a href="./index.php?m=contest&c=manage&a=add&is_activity=<?=$is_activity?>"><em><?php echo L($column)?>添加</em></a>
		<?php }?>
	</div>
</div>

<div class="pad-lr-10">
	<form name="searchform" action="" method="get">
		<input type="hidden" value="contest" name="m">
		<input type="hidden" value="manage" name="c">
		<input type="hidden" value="init" name="a">
		<input type="hidden" value="<?=$is_activity?>" name="is_activity">
		<?php if(isset($_GET['id'])){?>
			<input type="hidden" value="<?=$_GET['id']?>" name="id">
		<?php }?>
		<table width="100%" cellspacing="0" class="search-form">
			<tbody>
			<tr>
				<td>
					<div class="explain-col">

						<select name="type">
							<option value='1'
								<?php if(isset($_GET['type']) && $_GET['type']==1){?> selected
								<?php }?>><?php echo  L($column."_name")?></option>
							<option value='2'
								<?php if(isset($_GET['type']) && $_GET['type']==2){?> selected
								<?php }?>><?php echo L($column."_year")?></option>
							<option value='3'
								<?php if(isset($_GET['type']) && $_GET['type']==3){?> selected
								<?php }?>><?php echo  L($column."_address") ?></option>

						</select>
						<input name="keyword" type="text" value="<?php if(isset($_GET['keyword'])) {echo $_GET['keyword'];}?>"
										 class="input-text" />
						<input type="submit" name="search"  class="button" value="<?php echo L('search')?>" />
					</div>
				</td>
			</tr>
			</tbody>
		</table>
	</form>


	<form name="myform" action="?m=contest&c=manage&a=del" method="post"
		onsubmit="return confirm('<?php echo L('confirm')?>')">
		<div class="table-list">
			<table width="100%" cellspacing="0">
				<thead>
					<tr>
						<th align="center" width="20"><input type="checkbox" value=""
							id="check_box" onclick="selectall('id[]');"></th>
						<th align="center" width="20">ID</th>
						<th align="center" width="150"><?php echo L($column."_name") ?></th>
						<th align="center" width="30">年份</th>
						<th align="center" width="80"><?php echo L($column)."宣传图"; ?></th>
						<th align="center" width="80"><?php echo "开始时间"; ?></th>
						<th align="center" width="80"><?php echo "结束时间"; ?></th>
						<th align="center" width="80"><?php echo L($column."_type") ?></th>
						<th align="center" width="50"><?php echo "举办地"; ?></th>
						<th align="center" width="80"><?php echo "上次编辑者"; ?></th>
						<th align="center" width="300"><?php echo L($column."_operation") ?></th>
					</tr>
				</thead>
				<tbody>
<?php
if(!empty($contestinfo)){
foreach ($contestinfo as $k => $v) {
	if($v['parentid']!=0){
		$v['name']=str_repeat("&nbsp;",3).'├─'.$v['name'];
	}
    ?>
    <tr>
						<td align="center"><input type="checkbox"
							value="<?php echo $v['id']?>" name="id[]"></td>
						<td align="center"><?php echo $v['id'];?></td>
						<td align="center"><?php  if(!empty($v['name'])){echo $v['name'];}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(!empty($v['year'])){echo $v['year'];}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(isset($v['image_cover']) && !empty($v['image_cover'])){?><img src="<?=$v['image_cover']?>"  height="60" /><?php }else{echo "<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(!empty($v['begin_time'])){echo date('Y-m-d',strtotime($v['begin_time']));}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(!empty($v['end_time'])){echo date('Y-m-d',strtotime($v['end_time']));}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(!empty($this->type[$v['type']])){echo $this->type[$v['type']];}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center"><?php if(!empty($v['address'])){echo $v['address'];}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="left"><?php if(!empty($v['publisher'])){echo $v['publisher'];}else{echo"<span style='color:red;'>（未设置）</span>";}?></td>
						<td align="center">
							<a  href="?m=contest&c=manage&a=edit&id=<?php echo $v['id']?>"><?php echo  L($column."_edit");?></a>&nbsp;|&nbsp;
							<a href="?m=contest&c=manage&a=del&id=<?php echo $v['id']?>&is_activity=<?=$is_activity?>&name=<?php echo $v['name'];?>"
							onClick="return confirm('<?php echo L('confirm')?>')"><?php echo  L($column."_del")  ?></a>&nbsp;|&nbsp;
							<a  href="?m=contest&c=manage&a=view&id=<?php echo $v['id']?>">人才奖项</a>&nbsp;|&nbsp;
							<a  href="?m=contest&c=source&a=init&source_type=1&contest_id=<?php echo $v['id']?>">关联资源</a>&nbsp;|&nbsp;
							<?php if($v['parentid']==0){?>
								<a href="./index.php?m=contest&c=manage&a=add&is_activity=<?=$is_activity?>&id=<?=$v['id']?>"><em>添加子<?= $column_name?></em></a>
							<?php }?>

						</td>
					</tr>
<?php
}
}else{
    echo "<tr><td colspan='11' style='color:red;font-size:18px;text-align:center;'><span>暂无数据！</span></td></tr>";
}
?>
</tbody>
			</table>

			<div class="btn">
				<label for="check_box"><a href="#"
					onClick="javascript:$('input[type=checkbox]').attr('checked', true)"><?php echo L('select_all')?></a>/<a
					href="#"
					onClick="javascript:$('input[type=checkbox]').attr('checked', false)"><?php echo L('cancel')?></a></label>
				<input type="submit" class="button" name="dosubmit"
					value="<?php echo L('delete')?>" />
			</div>

<!--			<div id="pages">--><?php //echo $pages?><!--</div>-->
		</div>
	</form>
</div>
</body>
</html>